/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ufps.cuatro.util.editor;

import com.ufps.cuatro.modelo.representacion.componente.ComponenteDistribuidor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JComboBox;

/**
 *
 * @author Catc
 */
public class MyComboBoxEditor extends JComboBox implements ActionListener{
    private static final long serialVersionUID = -4955706161623854269L;
    
    private ComponenteDistribuidor objComponenteDistribuidor;
    
    /**
     *
     * @param items
     */
    public MyComboBoxEditor(Object[] items, ComponenteDistribuidor objComponenteDistribuidor) {
        super(items == null ? new Object[1] : items);
        this.objComponenteDistribuidor = objComponenteDistribuidor;
        this.addActionListener(MyComboBoxEditor.this);
    }
    

    @Override
    public void actionPerformed(ActionEvent e) {
       if(e != null){
            String item = (String) this.getSelectedItem();
            objComponenteDistribuidor.setStrPaquete(item);
        }
    }
}
